<!doctype html>
<!--                                                                        -->
<!-- Copyright 2008 Google Inc.                                             -->
<!-- Licensed under the Apache License, Version 2.0 (the "License"); you    -->
<!-- may not use this file except in compliance with the License. You may   -->
<!-- may obtain a copy of the License at                                    -->
<!--                                                                        -->
<!-- http://www.apache.org/licenses/LICENSE-2.0                             -->
<!--                                                                        -->
<!-- Unless required by applicable law or agreed to in writing, software    -->
<!-- distributed under the License is distributed on an "AS IS" BASIS,      -->
<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        -->
<!-- implied. License for the specific language governing permissions and   -->
<!-- limitations under the License.                                         -->
 
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <link type="text/css" rel='stylesheet' href='JSON.css'>
    <title>JSON Interoperability Example</title>
    <script type="text/javascript" language='javascript' src='json/json.nocache.js'></script>
  </head>
  <body>
    <noscript>
      <div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color:white; border: 1px solid red; padding: 4px; font-family: sans-serif">
        Your web browser must have JavaScript enabled
        in order for this application to display correctly.
      </div>
    </noscript>
    
    <h1>JSON Interop Using JSNI</h1>
    
    <div class="intro">
      This example application demonstrates a simple approach to 
      interoperating with services that return their output in JSON format.
      It uses GWT's JavaScript Native Interface (JSNI) to analyze a JSON 
      response and create Java-accessible objects.  The JSON classes in this sample 
      are general-purpose and can be reused in other projects if you find 
      them useful.
      
      <p>
      When you click the "Search" button below, you can browse the cached 
      results of a Yahoo JSON image search for "potato."  The response is 
      parsed into Java objects which are used to populate a tree view below.
      </p>

      <ul>
        <li>For more details on how the JSON response is parsed into a set 
            of Java objects, see the JSONParser class.
        <li>This is the
          <a href='json/search-results.js'>JSON</a> file used in this example.
      </ul>
      
      <div id="search">
      </div>
    </div>

    <table align="center" width="80%" style="margin-top: 1em">
      <tr><th style="text-align: center; margin: 1em">JSON Response Tree View</th></tr>
      <tr><td id="tree"></td></tr>
    </table>
  </body>
</html>
